#include <bits/stdc++.h>
#define max std::max

const int N = 50000 + 5;
const int M = 100000 + 10;

double k[M], b[M];
int tg[M << 2];

double w(int id, int pos) {
    if (!id) return -50.00;
    return k[id] * (pos - 1) + b[id];
}

void update(int id, int p = 1, int l = 1, int r = N) {
    //printf("%lf %lf\n", w(id, l), w(id, r));
    if (w(id, l) > w(tg[p], l) && w(id, r) > w(tg[p], r)) {/*puts("1");*/ tg[p] = id; return;}
    if (w(id, l) <= w(tg[p], l) && w(id, r) <= w(tg[p], r)) {/*puts("2");*/ return;}
    //puts("3");
    int mid = l + r >> 1;
    if (k[id] > k[tg[p]]) {
        if (w(id, mid) > w(tg[p], mid)) update(tg[p], p << 1, l, mid), tg[p] = id;
        else update(id, p << 1 | 1, mid + 1, r);
    }
    else {
        if (w(id, mid) > w(tg[p], mid)) update(tg[p], p << 1 | 1, mid + 1, r), tg[p] = id;
        else update(id, p << 1, l, mid);
    }
    return;
}

double query(int pos, int p = 1, int l = 1, int r = N) {
    if (l == r) return w(tg[p], pos);
    int mid = l + r >> 1;
    if (pos <= mid) return max(w(tg[p], pos), query(pos, p << 1, l, mid));
    else return max(w(tg[p], pos), query(pos, p << 1 | 1, mid + 1, r));
}

int main() {
    k[0] = b[0] = -1.0;
    int n; scanf("%d", &n); int len = 0;
    for (int i = 1; i <= n; i++) {
        char s[20]; scanf("%s", s);
        if (s[0] == 'P') {
            len++; scanf("%lf%lf", b + len, k + len); update(len, 1, 1, N);
        }
        else {
            int x; scanf("%d", &x); printf("%d\n", int(query(x, 1, 1, N) / 100));
        }
    }
    return 0;
}//luogu blue mary 开公司